package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.TransportTaskPorterEntity;
import com.jinmdz.fmis.mapper.mapper.provider.TransportTaskPorterProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * 接运抬尸工表Mapper
 *
 * @author generator
 * @date 2020-03-12 17:08
 */
public interface TransportTaskPorterMapper {

    /**
     * 增加TransportTaskPorter
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @InsertProvider(type = TransportTaskPorterProvider.class, method = "insertTransportTaskPorter")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertTransportTaskPorter(@Param("entity") TransportTaskPorterEntity entity);

    /**
     * 删除TransportTaskPorter
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @Update(" update transport_task_porter set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForTransportTaskPorter(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改TransportTaskPorter
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @UpdateProvider(type = TransportTaskPorterProvider.class, method = "updateTransportTaskPorter")
    void updateTransportTaskPorter(@Param("entity") TransportTaskPorterEntity entity);

    /**
     * 查询TransportTaskPorter实体
     *
     * @param id 主键
     * @return TransportTaskPorterEntity
     * @author generator
     * @date 2020-03-12 17:08
     */
    @Select(" select id,deleted,transport_task_id,system_user_id,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from transport_task_porter where id = #{id} and deleted = 0 limit 1 ")
    TransportTaskPorterEntity getTransportTaskPorterById(@Param("id") Integer id);

    /**
     * 查询TransportTaskPorter列表
     *
     * @param entity 数据实体
     * @return TransportTaskPorterEntity
     * @author generator
     * @date 2020-03-12 17:08
     */
    @SelectProvider(type = TransportTaskPorterProvider.class, method = "listTransportTaskPorter")
    ArrayList<TransportTaskPorterEntity> listTransportTaskPorter(@Param("entity") TransportTaskPorterEntity entity);
}